//
//  StatusCell.swift
//  weibo
//
//  Created by Fosen on 15/12/5.
//  Copyright © 2015年 fosen. All rights reserved.
//

import UIKit
import SnapKit

let StatusCellMargin : CGFloat = 12
let StatusCellImageWidth : CGFloat = 35
//顶部视图 配图视图  底部工具视图
class StatusCell: UITableViewCell {

    var status:Status?{
    
        didSet{
        originalView.status = status
        
        }
    
    
    }
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    
    //MARK:设置UI
    private func setupUI(){
    
        contentView.addSubview(originalView)
        contentView.addSubview(bottomView)


    
        originalView.snp_makeConstraints { (make) -> Void in
            
            make.top.left.right.equalTo(contentView)
            
        }
        
        
        
        bottomView.snp_makeConstraints { (make) -> Void in
            
            make.top.equalTo(originalView.snp_bottom)
            make.left.right.equalTo(originalView)
            make.height.equalTo(40)
        }
        
        
        
        //需要给contentView添加约束
        contentView.snp_makeConstraints { (make) -> Void in
            
            make.top.left.right.equalTo(self)
            //给contentView底部添加约束非常重要
            make.bottom.equalTo(bottomView.snp_bottom)
        }
    }
    
    //MARK:懒加载子视图
    private lazy var originalView: StatusOriginalView = StatusOriginalView()
    
    private lazy var bottomView: StatusBottomView = StatusBottomView()
    
    
    
}
